package headline

import (
	"context"
	"errors"
	pb "rpc/api/video"
	"rpc/model"
)

// 定义空接口
type UserInfoService struct {
	pb.UnimplementedVideoServiceServer
}

// 实现方法 // 视频发布
func (s *UserInfoService) VideoPublish(ctx context.Context, req *pb.VideoPublishRequest) (resp *pb.VideoPublishResponse, err error) {
	if req.VideoTitle == "" {
		return nil, errors.New("视频标题不能为空")
	}
	v := model.VideoReleaseWeek3{
		VideoTitle:    req.VideoSubTitle,
		VideoSubTitle: req.VideoSubTitle,
		VideoAddress:  req.VideoAddress,
		VideoViews:    req.VideoViews,
		VideoType:     req.VideoType,
		VideoRegion:   req.VideoRegion,
		VideoImage:    req.VideoImage,
	}

	return &pb.VideoPublishResponse{VideoID: int64(v.ID)}, nil
}
